# 处理json数据
from pathlib import Path
import json

numbers = [2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]

path = Path('pi_digits.txt')
contents = json.dumps(numbers)
print(contents)
try:
    contents = path.write_text(contents)
except FileNotFoundError:
    print("文件未找到，请检查文件路径。")